home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 436_01 / inlib.mak < prev    next >
Text File  |  1994-10-07  |  5KB  |  132 lines

  1. #==========================================================================
  2. # INLIB.MAK
  3. #
  4. # Creates INCONx.LIB for the memory model defined on the
  5. # command line ("-DMDL=x"), where x is one of s, c, m, or l.
  6. # Does an unconditional build of each library, placing the
  7. # .LIB file into the directory named in O_DIR.
  8. #
  9. # MAKE.EXE doesn't support redirection on ECHO, so this file
  10. # calls INLIB.BAT to move INCON's header files into the output
  11. # directory and create INLIB.H.  If the INLIB.BAT is not available,
  12. # you can recreate it from the following comments (note that the
  13. # "ECHO/ " statements are followed by a space, and the spaces in the
  14. # FOR...IN...DO statement).
  15. #
  16. # ::INLIB.BAT
  17. # echo off
  18. # ::Filter out root, shorthand, and (most) invalid path names.
  19. # for %%x in (\ . .\ .\\ .. ..\ ..\\) do if "%%x"=="%1" goto :BAD_PATH
  20. # if not exist %1nul goto :BAD_PATH
  21. # echo Creating inlib.rsp ...
  22. # echo -+%1incon       & >  inlib.rsp
  23. # echo -+%1inalpha     & >> inlib.rsp
  24. # echo -+%1infloat     & >> inlib.rsp
  25. # echo -+%1inintgr     & >> inlib.rsp
  26. # echo -+%1intempl     & >> inlib.rsp
  27. # echo -+%1inutil      & >> inlib.rsp
  28. # echo -+%1stringz.obj   >> inlib.rsp
  29. # echo/ 
  30. # echo Copying INCON header files to %1 ...
  31. # echo/ 
  32. # echo copy indefs.h  %1indefs.h
  33. #      copy indefs.h  %1indefs.h  > nul
  34. # echo copy indecl.h  %1indecl.h
  35. #      copy indecl.h  %1indecl.h  > nul
  36. # echo copy stringz.h %1stringz.h
  37. #      copy stringz.h %1stringz.h > nul
  38. # echo/ 
  39. # echo Creating %1inlib.h ...
  40. # echo #include "%1indefs.h"  >  %1inlib.h
  41. # echo #include "%1indecl.h"  >> %1inlib.h
  42. # echo #include "%1stringz.h" >> %1inlib.h
  43. # echo/ 
  44. # echo Contents of %1inlib.h:
  45. # echo/ 
  46. # type %1inlib.h
  47. # goto :EXIT
  48. # :BAD_PATH
  49. # echo Invalid path:  %1
  50. # echo/ 
  51. # echo Path must be name, ending with '\'
  52. # goto :EXIT
  53. # :EXIT
  54. #==========================================================================
  55. #
  56. # TCC options are:
  57. #  -c    compile to OBJ
  58. #  -d    merge duplicate strings
  59. #  -f-   no floating point
  60. #  -G    optimize for speed
  61. #  -I    include directories
  62. #  -L    library directories
  63. #  -mx   memory model x
  64. #  -O    jump optimization
  65. #  -o    name object file
  66. #  -r    use register variables
  67. #  -w    display all warnings
  68. #  -Z    register optimization
  69. #
  70. # TASM options are:
  71. #  /ml   all symbols case sensitive
  72. #  /t    suppress messages if assembly ok
  73. #  /w2   enable warning messages
  74. #  /z    display source line w/error message
  75. #
  76. # TLIB options are:
  77. #  /C    case-sensitive library
  78. #  /E    create extended dictionary
  79. #==========================================================================
  80.  
  81. # If memory model not defined, use large.
  82.  
  83. !if !$d(MDL)
  84. MDL=l
  85. !endif
  86.  
  87. # Define paths for Turbo C and output directories.  Make changes to
  88. # these constants if your directory structure is set up differently.
  89. # O_DIR tells TCC and TASM where to put the object files, and TLIB
  90. # where to build the library.  The batch files listed above adapt
  91. # to any changes you make to O_DIR (note the trailing backslash).
  92.  
  93. TCC      = \tc\tcc                     # path to TCC.EXE
  94. TASM     = \tasm\tasm                  # path to TASM.EXE
  95. TLIB     = \tc\tlib                    # path to TLIB.EXE
  96. TLINK    = \tc\tlink                   # path to TLINK.EXE
  97. O_DIR    = \tc\usr\                    # output directory
  98.                                        #  (note the trailing '\')
  99. I_DIR    = \tc\inc;\tc\inc\sys         # include directory
  100.  
  101. C_OPTS   = -c -d -f- -G -I$(I_DIR) -m$(MDL) -O -r -w -Z
  102. A_OPTS   = /ml/t/w2/z
  103. COMPILE  = $(TCC) $(C_OPTS)
  104.  
  105. # Call INLIB.BAT to create INLIB.RSP, move the required header
  106. # files into O_DIR, and create INLIB.H.  Then do an unconditional
  107. # compile of each file required by the library and put the object
  108. # files into O_DIR.  After the library has been created, delete
  109. # the old library and all of the object files.
  110. #
  111. # The compiler command lines below include a macro defined by
  112. # Borland's MAKE.EXE that allows use of switches stored in
  113. # environment variables.  The macros below all reference an
  114. # environment variable named X, defined by "set x=text_string".
  115.  
  116. $(O_DIR)incon$(MDL).lib:
  117.    inlib $(O_DIR)                                  # call INLIB.BAT
  118.    $(COMPILE) $(X) -o$(O_DIR)incon   incon
  119.    $(COMPILE) $(X) -o$(O_DIR)inalpha inalpha
  120.    $(COMPILE) $(X) -o$(O_DIR)infloat infloat
  121.    $(COMPILE) $(X) -o$(O_DIR)inintgr inintgr
  122.    $(COMPILE) $(X) -o$(O_DIR)intempl intempl
  123.    $(COMPILE) $(X) -o$(O_DIR)inutil  inutil
  124.    $(TASM) $(A_OPTS) stringz, $(O_DIR)stringz;
  125.    del $(O_DIR)incon$(MDL).lib
  126.    $(TLIB) $(O_DIR)incon$(MDL) @inlib.rsp
  127.    del $(O_DIR)incon$(MDL).bak
  128.    del $(O_DIR)in*.obj
  129.    del inlib.rsp
  130.  
  131. # EOF:  INLIB.MAK 
  132.